'use strict';
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('IntegralIns', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      userId: {
        type: Sequelize.INTEGER,
        allowNull: false,
        onDelete: "CASCADE",
        onUpdate: "CASCADE",
        references: {
          model: 'Users',
          key: 'id'
        }
      },
      total: {
        allowNull: false,
        type: Sequelize.INTEGER,
        comment: '总和'
      },
      number: {
        allowNull: false,
        type: Sequelize.INTEGER,
        comment: '收入'
      },
      type: {
        allowNull: false,
        type: Sequelize.INTEGER(1),
        comment: '1：收获、2：每日分享'
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE(3)
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE(3)
      }
    }, {
      paranoid: false,
      charset: 'utf8mb4',
      collate: 'utf8mb4_general_ci',
      comment: '幸运草收入表',
    });
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('IntegralIns');
  }
};